@extends('admin/layouts.default')

{{-- Web site Title --}}
@section('title')
Branche Management ::
@parent
@stop

{{-- Content --}}
@section('content')
<div class="page-header">
    <h3>
        Branche Managment

        <div class="pull-right">
            <a href="{{{ URL::to('admin/places/create') }}}" class="btn btn-small btn-info"><i class="icon-plus-sign icon-white"></i> Create</a>
        </div>
    </h3>
</div>
<div class="filter">
    <form class="form-inline">
         <input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
         <input type="text" name="q" placeholder="search"/>
         {{-- Banks --}}
        <select name="place">
            <option value="0">All Banks</option>
            @foreach ($places as $place)
            <option value="{{$place->id}}">{{$place->name}}</option>
            @endforeach
        </select>
         {{-- Provinces --}}
         <select name="province">
            <option value="0">All Province</option>
            @foreach ($provinces as $province)
            <option value="{{$province->id}}">{{$province->name }}</option>
            @endforeach
        </select>
         <button type="submit" class="btn">Filter</button>
    </form>
</div>
<table class="table table-bordered table-hover">
    <thead>
        <tr>
            <th>{{{ Lang::get('admin/places/table.logo') }}}</th>
            <th>Brach</th>
            <th>Branch of</th>
            <th class="span2">Province/City</th>
            <th class="span2">{{{ Lang::get('admin/places/table.created_at') }}}</th>

            <th class="span2">{{{ Lang::get('table.actions') }}}</th>
        </tr>
    </thead>
    <tbody>
        @foreach ($branches as $b)
        <tr>
            <td class="logo"><img src="/uploads/images/{{{ strlen($b->branch_logo)> 0 ? 'branches/thumb/'.$b->branch_logo : 'thumb/' . $b->place->logo }}}" alt="{{{ $b->place->name }}}"/></td>
            <td class="name">{{{ strlen($b->branch_name) > 0 ? $b->branch_name : $b->place->name . ' in ' . $b->province->name}}} </td>
            <td class="name">{{{ $b->place->name }}}</td>
            <td class="name">{{{ $b->province->name }}}</td>
            <td class="date">{{{ $b->place->getPresenter()->created_at() }}}</td>
            <td>
                <a href="{{{ URL::to('admin/branches/' . $b->id . '/edit') }}}" class="btn btn-mini">{{{ Lang::get('button.edit') }}}</a>
                <a href="{{{ URL::to('admin/branches/' . $b->id . '/delete') }}}" class="btn btn-mini btn-danger">{{{ Lang::get('button.delete') }}}</a>
            </td>
        </tr>
        @endforeach
    </tbody>
</table>

{{ $branches->links() }}
@stop
